const clockInModel = require("../models/clockInModel");
const {getDataByPage} = require("../utils/tools");

// 创建一个打卡记录
exports.createClockIn = (clockInfo) => {
    return clockInModel.create(clockInfo)
}


// 查询打卡记录
exports.findClockIn = (queryCondition) => {
    return getDataByPage(clockInModel, queryCondition, "user", "recruitmentInfo")
}


// 修改打卡记录
exports.updateClockIn = (id, newClockInInfo) => {
    console.log(id,newClockInInfo,123)
    return clockInModel.updateOne({
        _id:id,
        recruitmentInfo: newClockInInfo.recruitmentInfo
    }, newClockInInfo)
}


// 通过ID获取打卡信息
exports.findClockInById = (id,user)=>{
    console.log(id,user)
    return clockInModel.findOne({
        _id:id,
        user,
    })
}
